package xmu.crms.util;

import io.jsonwebtoken.Jwt;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import xmu.crms.config.security.AuthServiceImpl;
import xmu.crms.vo.SignInVO;

import java.math.BigInteger;

/**
 * Created by status200 on 2017/12/25.
 */
@RunWith(SpringRunner.class)
@SpringBootTest
public class testJwtUtil {

    @Autowired
    private AuthServiceImpl authService;

    private Log log = LogFactory.getLog(testJwtUtil.class);

    @Test
    public void testGetIdFromAuthString() throws Exception {

        SignInVO vo = authService.doMyLogin("233");

        BigInteger id = JwtUtil.getIdFromToken(vo.getJwt());

        log.info(id);
    }
}
